from utils.JSON的输入和输出 import 写入json
'''
将DLG_Text 转成 json
'''

with open("output/解密后/DLG_Text.txt", 'r', encoding='utf-8') as f:
    data = f.read()

words = [word for word in data.split('\u0000') if word]

queue = []


def 去除修饰(word: str) -> str:
    chars = ["@3", "@2", "@0", "\""]
    for char in chars:
        word = word.replace(char, "")
    return word


for word in words:
    queue.append({'word': word, 'trans': ''})
    # queue.append({'word': 去除修饰(word), 'trans': ''})

写入json(queue, 'output/JSON/DLG_Text.json')